CREATE TABLE [dbo].[tb_Insumos]
(
[idInsumo] [int] NOT NULL IDENTITY(1, 1),
[Edificio] [int] NOT NULL,
[TipoDeInsumo] [int] NOT NULL,
[Descripcion] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ProveedorHabitual] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[FechaDeStock] [datetime] NOT NULL,
[CantStock] [int] NOT NULL,
[CantMinStock] [int] NOT NULL,
[ConsPromMensual] [int] NOT NULL,
[UnidadDeMedida] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CostoPromMensual] [int] NOT NULL,
[Financiamiento] [int] NOT NULL,
[PartidaPresupuestaria] [int] NULL,
[FormaDePago] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_Insumos] ADD CONSTRAINT [PK_tb_Insumos] PRIMARY KEY NONCLUSTERED  ([idInsumo]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [idxInsumosEdificio] ON [dbo].[tb_Insumos] ([Edificio]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_Insumos] WITH NOCHECK ADD CONSTRAINT [FK_tb_Insumos_tb_Edificios] FOREIGN KEY ([Edificio]) REFERENCES [dbo].[tb_Edificios] ([idEdificio]) NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[tb_Insumos] ADD CONSTRAINT [FK_tb_Insumos_tb_FuentesDeFinanciamiento] FOREIGN KEY ([Financiamiento]) REFERENCES [dbo].[tb_FuentesDeFinanciamiento] ([idFuenteFinanciamiento])
GO
ALTER TABLE [dbo].[tb_Insumos] WITH NOCHECK ADD CONSTRAINT [FK_tb_Insumos_tb_PartidasPresupuestarias] FOREIGN KEY ([PartidaPresupuestaria]) REFERENCES [dbo].[tb_PartidasPresupuestarias] ([idPartida])
GO
ALTER TABLE [dbo].[tb_Insumos] WITH NOCHECK ADD CONSTRAINT [FK_tb_Insumos_tb_TiposDeInsumos] FOREIGN KEY ([TipoDeInsumo]) REFERENCES [dbo].[tb_TiposDeInsumos] ([idTipoDeInsumo])
GO
ALTER TABLE [dbo].[tb_Insumos] NOCHECK CONSTRAINT [FK_tb_Insumos_tb_Edificios]
GO
